<?php

use Illuminate\Database\Seeder;

class AdminSeeder extends Seeder
{
    /**
     * Run the database seeds.
     *
     * @return void
     */
    public function run()
    {
        $admins = factory(\App\Admin::class, 10)->create();
        $admin = $admins[0];
        $admin->password = bcrypt('admin888');
        $admin->nickname = '超级管理员';
        $admin->name = 'admin';
        $admin->save();
        $admin1 = $admins[1];
        $admin1->password = bcrypt('admin888');
        $admin1->nickname = '管理员';
        $admin1->name = 'admin1';
        $admin1->save();

        \Spatie\Permission\Models\Role::query()->create([
            'title' => "站长",
            'name' => "webmaster",
            'guard_name' => 'admin'
        ]);

        \Spatie\Permission\Models\Role::query()->create([
            'title' => "管理员",
            'name' => "admin",
            'guard_name' => 'admin'
        ]);
        $admin->assignRole('webmaster');
        $admin1->assignRole('admin');
    }
}
